// 遇到0结束
var readline = require('readline');

let rows = [];
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
})

rl.on('line', line => {
  rows.push(line);
  // 遇到0结束读取每行
  if (rows[rows.length - 1] === '0') {
    rows.pop();
    rows.forEach(li => {
      // let numArr = li.split(' ')
      // console.log(numArr);
      console.log(li);
      console.log(calculate(li));
      // 算法代码写在这里
    })
    rl.close();
  }
})


// 没括号
var calculate = function(s) {
  let sign = '+', n = 0, c, stack = [];
  for (let i = 0; i <= s.length; i++) {
    c = s[i];
    if (c === ' ') continue;
    if (c <= '9' && c >= '0') {
      n = n * 10 + parseInt(c);
      continue;
    }
    if (sign === '+') {
      stack.push(n);
    } else if (sign === '-') {
      stack.push(-n);
    } else if (sign === '*') {
      stack.push(stack.pop() * n)
    } else if (sign === '/') {
      stack.push(stack.pop() / n)
    }
    sign = c;
    n = 0;
  }
  return stack.reduce((acc, n) => acc + n, 0).toFixed(2);
};

// 有括号
function solve(s) {
  const stack = [];
  let n = 0, sign = '+';
  for (let i = 0; i <= s.length; i++) {
    if (s[i] === ' ') continue;
    if (s[i] >= '0' && s[i] <= '9') {
      n = n * 10 + parseInt(s[i]);
      continue;
    }
    if (s[i] === '(') {
      let j = i + 1;
      let counterPartition = 1;
      while (counterPartition > 0) {
        if (s[j] === '(') {
          counterPartition++;
        }
        if (s[j] === ')') {
          counterPartition--;
        }
        j++;
      }
      n = solve(s.slice(i + 1, j - 1));
      i = j - 1;
      continue;
    }
    if (sign === '+') {
      stack.push(n);
    } else if (sign === '-') {
      stack.push(-n);
    } else if (sign === '*') {
      stack.push(stack.pop() * n);
    } else if (sign === '+') {
      stack.push(stack.pop() / n);
    }
    sign = s[i];
    n = 0;
  }
  while (stack.length) {
    n += stack.pop();
  }
  return n;
}
